import {defineStore} from "pinia";
import {onMounted, ref} from "vue";
import {pageOrder} from "@/apis/order.js";

/**
 * 分页获取订单store
 * @type
 */
export const getOrderStore = defineStore('order',()=>{
    const orderList = ref([]);

    const fetchOrderList = async (page, size, searchAndOrder) => {
        const response = await pageOrder(page, size, searchAndOrder)

        orderList.value = response.data.records
        console.log("orderList: "+orderList.value)
    }


    return{orderList,fetchOrderList}
}, {
        persist: true
    }
)